<template>
  <div class="index">
    <div class="flex-c bar_nav">
      <div class="tab_nav">
        <button v-for="(item,index) in tab_nav" :class="main_active==index?'active':''"
        @click="main_active=index">{{ item }}</button>
      </div>
    </div>
    <div class="menu-box">
      <ul>
        <li :class="default_active == 1 ? 'active' : ''" @click="default_active = 1">
          版块
        </li>
        <!-- <li :class="default_active == 2 ? 'active' : ''" @click="default_active = 2">
          大盘
        </li>

        <li :class="default_active == 3 ? 'active' : ''" @click="default_active = 3">
          全球
        </li> -->
        <li :class="default_active == 4 ? 'active' : ''" @click="default_active = 4">
          国内
        </li>
        <!-- <li>
          <el-switch v-model="switchType" active-color="#13ce66" @change="switchBtn()" inactive-color="#ff4949">
          </el-switch>
        </li> -->
      </ul>
    </div>
    <transition name="el-zoom-in-center">
      <div class="main_view" v-if="main_active==0">
        <section class="section-item1" v-if="default_active == 1">
          <sectionBox></sectionBox>
        </section>
        <section class="section-item2" v-if="default_active == 2">
          <sectionBox2></sectionBox2>
        </section>
        <section class="section-item2" v-if="default_active == 3">
          <sectionBox4></sectionBox4>
        </section>
        <section class="section-item2" v-if="default_active == 4">
          <sectionBox3></sectionBox3>
        </section>
      </div>
    </transition>
    <transition name="el-zoom-in-center">
       <analysis v-if="main_active==1"></analysis>
      </transition>
     <transition name="el-zoom-in-center">
       <fixedToolIndex v-if="main_active==2"></fixedToolIndex>
      </transition>
  </div>
</template>
<script>
import { ElZoomInCenter } from 'element-ui';
export default {
  data() {
    return {
      tab_nav:[
        '资金仓位','策略验证','回测数据',
      ],
      main_active:0,
      default_active: 1,
      switchType: false,
    };
  },

  created() {
    this.switchType = sessionStorage.getItem("this_view_type") ? true : false;
  },
  components: {
    ElZoomInCenter,
    fixedToolIndex:() => import("./financialTestingTool/index.vue"),
    analysis:() => import("./analysis.vue"),
    sectionBox: () => import("./indexItem/sectionBox.vue"),
    sectionBox2: () => import("./indexItem/sectionBox2.vue"),
    sectionBox3: () => import("./indexItem/sectionBox3.vue"),
    sectionBox4: () => import("./indexItem/sectionBox4.vue"),
  },
  methods: {
    switchBtn() {
      if (this.switchType == false) {
        sessionStorage.removeItem("this_view_type");
      } else {
        sessionStorage.setItem("this_view_type", 1);
      }
    },
    toLink() {
      let routeData = this.$router.resolve({
        path: "/linkBox",
      });
      window.open(routeData.href, "_blank");
    },
    handleOpen(key, keyPath) {
    },
    handleClose(key, keyPath) {
    },
  },
};
</script>
<style scoped lang="scss">
.index {
  background-color: #ffffff;
  min-height: 100vh;
  width: 100%;

  .bar_nav {
    background-color: #eff3f8;
    box-shadow: 0px 3px 3px 4px #0000001c;
    padding: 2px;
    width: 100%;
    transition: all 0.1s linear;
    .tab_nav {
      border-radius: 20px;
      border: 3px solid #000000;
      margin: 0 auto;
      box-sizing: border-box;
      overflow: hidden;
      background-color: black;

      button {
        padding: 5px 20px;
        background-color: #f0f0f000;
        font-size: 12px;
        color: #ffffff;
         transition: all 0.1s linear;
      }

      .active {
        background-color: #fbcd05;
        border-radius: 15px;
        font-weight: 600;
        letter-spacing: 1px;
        color: #462d07;
      }
    }


  }
  .bar_nav:hover{
    padding: 20px;
     button{
      padding: 15px 30px;
      font-size: 24px;
     }
  }
  .link_btn {
    border-radius: 50px;
    width: 60px;
    height: 60px;
    background-color: #8bc34a;
    color: white;
    position: absolute;
    right: 5%;
    top: -15%;
    border-radius: 10px 10px 20px 0px;
  }

  header {
    height: 40px;
    width: 100%;
    background-color: #272633;
    justify-content: center;
  }

  section {
    padding: 0px 0px;
    min-height: 100px;
    width: 100%;
    overflow: hidden;
  }

  .menu-box {
    position: fixed;
    background-color: #ff9800;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0%;
    width: auto;
    z-index: 100;
    padding: 5px 5px 0px 5px;
    box-shadow: 1px -2px 3px 4px #89898933;
    border-radius: 10px 10px 0px 0px;

    ul {
      display: flex;
      width: auto;
    }

    li {
      padding: 10px 20px;
      margin: 0px 10px;
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 1px;
      text-align: right;
      color: wheat;
      box-sizing: content-box;
      cursor: pointer;
      letter-spacing: 1px;
    }

    .active {
      background-color: white;
      color: #000000;
      font-size: 18px;
      font-weight: 600;
      border-radius: 20px;
      width: 70px;
      height: 40px;
      padding: 0px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }

}
</style>
